package com.youfan.control;

import com.youfan.consumer.ReceiveYoufanOrder;
import com.youfan.entity.YoufanOrder;
import com.youfan.re.Result;
import com.youfan.service.SendMsgService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "message")
public class MessageControl {
    Logger logger= LoggerFactory.getLogger(ReceiveYoufanOrder.class);
    @Autowired
    private SendMsgService sendMsgService;

    @RequestMapping(method = RequestMethod.POST,value = "sendOrderMessage")
    @ResponseBody
    public Result sendOrderMessage(@RequestBody YoufanOrder youfanOrder)
    {
        try {
            sendMsgService.sendOrderInfo(youfanOrder);
            return Result.success("订单信息发送成功");
        }catch (Exception e){
            e.printStackTrace();
            return Result.fail("订单信息发送失败");
        }
    }




}
